﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SQLite;

namespace StudentControlSystem.Controller
{
    public static  class Log
    {   

        // 添加日志记录的方法
        public static void LogAction(string action)
        {
            using (var connection = new SQLiteConnection(DBHelper.ConnStrings))
            {
                connection.Open();
                var command = new SQLiteCommand("INSERT INTO Logs (Action, Timestamp) VALUES (@action, @timestamp)", connection);
                command.Parameters.AddWithValue("@action", action);
                command.Parameters.AddWithValue("@timestamp", DateTime.Now);
                command.ExecuteNonQuery();
            }
        }
    }
}
